{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "332126f9-3524-4223-bcc6-24b9818b77b5",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "from mythic import mythic"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "abfa531f-5e7a-400b-910c-92a62106ccbe",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "mythic_instance = await mythic.login(\n",
    "        username=\"mythic_admin\",\n",
    "        password=\"mythic_password\",\n",
    "        server_ip=\"mythic_nginx\",\n",
    "        server_port=7443,\n",
    "        timeout=-1\n",
    "    )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "77b89409-31c8-44d8-877f-bec19f261e01",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# ########## Get Compromised Hosts, Users, IP Addresses ###########\n",
    "\n",
    "hosts = await mythic.get_unique_compromised_hosts(mythic=mythic_instance)\n",
    "print(hosts)\n",
    "users = await mythic.get_unique_compromised_accounts(mythic=mythic_instance)\n",
    "print(users)\n",
    "ips = await mythic.get_unique_compromised_ips(mythic=mythic_instance)\n",
    "print(ips)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0ce250ef-a637-4b83-aa62-79f09c28fadd",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# ########## Send a message to the operational event log ###########\n",
    "await mythic.send_event_log_message(mythic=mythic_instance, message=\"test\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "975eab51-1a38-4898-bd1b-273ac063c8a0",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# ########## Send a warning message to the operational event log ###########\n",
    "await mythic.send_event_log_message(mythic=mythic_instance, message=\"test\", level=\"warning\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9ef243af-57d8-43d8-b516-01cad4b77981",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# ########## Send a custom webhook message ###########\n",
    "await mythic.send_custom_webhook_message(mythic=mythic_instance, webhook_type=\"new_custom\", webhook_data={\"some data\": \"some value\", \"other\": \"other2\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c0314a01-6677-4e0b-a47f-a1ed344f2ac9",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
